package huoye.shops.huoye.mine.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.huoye.mine.activity.EditShopMessageActivity;
import huoye.shops.huoye.mine.model.PostDepositRec;
import huoye.shops.huoye.user.model.User;


/**
 * Created by uesr on 2017/8/3.
 */

public class RecordPayAdapter extends RecyclerViewAdapter<RecordPayAdapter.ViewHolder,PostDepositRec> {




    public RecordPayAdapter(Context context) {
        super(context, R.layout.item_record_pay);
    }

    @Override
    protected ViewHolder initViewHolder(View view, int i) {
        return new ViewHolder(view);
    }

    @Override
    protected void bindView(ViewHolder holder, PostDepositRec postDepositRec, int i) {
      /*  if(postDepositRec.getRecordType().equals(TYPE_WITHDRAW)){
            holder.tvCover.setText("提现 -"+postDepositRec.getMoney());
        }else {
            holder.tvCover.setText("收入 +"+postDepositRec.getMoney());
        }*/

        //记录类型(1:提现 2：销售订单收入 3：黑卡提成收入)
        switch (postDepositRec.getRecordType()){
            case 1:
                holder.tvCover.setText("提现 -"+postDepositRec.getMoney());
                break;
            case 2:
                holder.tvCover.setText("销售订单收入 +"+postDepositRec.getMoney());
                break;
            case 3:
                holder.tvCover.setText("黑卡提成收入 +"+postDepositRec.getMoney());
                break;
        }



       holder.tvTime.setText(postDepositRec.getRecordTime());

        //状态（0：未审核 1：已完成 2：审核失败）-
        int state = postDepositRec.getState();
        switch (state){
            case 0:
                holder.tvState.setText("未审核");
                holder.tvState.setSelected(true);
                break;
            case 1:
                holder.tvState.setText("已完成");
                holder.tvState.setSelected(false);
                break;
            case 20:
                holder.tvState.setText("审核失败");
                holder.tvState.setSelected(true);
                break;
        }



    }

    public class ViewHolder extends RecyclerViewAdapter.ViewHolder {

        @BindView(R.id.item_record_pay_tv_type)
        public TextView tvCover;
        @BindView(R.id.item_record_pay_tv_state)
        public TextView tvState;
        @BindView(R.id.item_record_pay_tv_time)
        public TextView tvTime;

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
